package ${package.ServiceImpl};

import ${superServiceImplClassPackage};
import com.github.pagehelper.PageHelper;
import org.flowers.unbeaten.base.entity.BaseEntity;
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import org.flowers.unbeaten.util.PageUtils;
import org.flowers.unbeaten.util.PageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * ${table.comment!} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Service
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {

    @Autowired
    private ${table.mapperName} ${lowerMapperName};

    /**
     * 分页查询列表
     * @param ${lowerEntityName}
     * @return
     */
    @Override
    public PageVo<${entity}> getPageList(${entity} ${lowerEntityName}, BaseEntity baseEntity) {
        PageHelper.startPage(baseEntity.getPage(), baseEntity.getLimit());
        List<${entity}> list = ${lowerMapperName}.selectPageList(${lowerEntityName});
        return PageUtils.getPageVo(list);
    }

    /**
     * 新增数据
     * @param ${lowerEntityName}
     */
    @Override
    public void add(${entity} ${lowerEntityName}) {
        ${lowerMapperName}.insert(${lowerEntityName});
    }

    /**
     * 修改数据
     * @param ${lowerEntityName}
     */
    @Override
    public void edit(${entity} ${lowerEntityName}) {
        ${lowerMapperName}.updateById(${lowerEntityName});
    }

    /**
     * 查看详情
     * @param ${keyPropertyName}
     * @return
     */
    @Override
    public ${entity} detail(${keyPropertyType} ${keyPropertyName}) {
        return ${lowerMapperName}.selectById(${keyPropertyName});
    }

    /**
     * 批量删除
     * @param ids
     * @return
     */
    @Override
    public void delete(List<String> ids) {
        ${lowerMapperName}.deleteBatchIds(ids);
    }

}

